
#ifndef UCDB_SORTTAB_H
#define UCDB_SORTTAB_H 1

#include "zdbmain.h"

class UcDbImpSortentsTable;

class UcDbSortentsTable : public UcDbObject
{

public:

    UCRX_DECLARE_MEMBERS(UcDbSortentsTable);

                        UcDbSortentsTable();
    virtual             ~UcDbSortentsTable();

    ZSoft::Boolean      sortAs(UcDbObjectId, UcDbHandle&) const;
    void                getSortHandle(UcDbObjectId id, UcDbHandle& h) const;

    Ucad::ErrorStatus   remove(UcDbObjectId);

    Ucad::ErrorStatus   moveToBottom(const UcDbObjectIdArray& ar);
    Ucad::ErrorStatus   moveToTop(const UcDbObjectIdArray& ar);

    Ucad::ErrorStatus   moveBelow(const UcDbObjectIdArray& ar,
                                  UcDbObjectId target);
    Ucad::ErrorStatus   moveAbove(const UcDbObjectIdArray& ar,
                                  UcDbObjectId target);

    Ucad::ErrorStatus   swapOrder(UcDbObjectId, UcDbObjectId);

    Ucad::ErrorStatus   setBlockId(UcDbObjectId);
    UcDbObjectId        blockId() const;

    Ucad::ErrorStatus   firstEntityIsDrawnBeforeSecond(UcDbObjectId first,
                                                       UcDbObjectId second,
                                                       bool& result) const;

    Ucad::ErrorStatus   getFullDrawOrder(UcDbObjectIdArray& ents,
                                         ZSoft::UInt8 honorSortentsMask=0) const;

    Ucad::ErrorStatus   getRelativeDrawOrder(UcDbObjectIdArray& ar,
                                             ZSoft::UInt8 honorSortentsMask=0) const;

    Ucad::ErrorStatus   setRelativeDrawOrder(const UcDbObjectIdArray& ar);

    virtual Ucad::ErrorStatus   applyPartialUndo(UcDbDwgFiler*, UcRxClass*);
    virtual Ucad::ErrorStatus   dwgInFields(UcDbDwgFiler*);
    virtual Ucad::ErrorStatus   dwgOutFields(UcDbDwgFiler*) const;
    virtual Ucad::ErrorStatus   dxfInFields(UcDbDxfFiler*);
    virtual Ucad::ErrorStatus   dxfOutFields(UcDbDxfFiler*) const;
    virtual Ucad::ErrorStatus   audit(UcDbAuditInfo* pAuditInfo);
    virtual Ucad::ErrorStatus   getClassID(CLSID* pClsid) const;

private:
    friend class UcDbSystemInternals;
    UcDbImpSortentsTable*   mpImpObj;
};

#endif 
